<!doctype html>	
<html>	
  <head>	
    <meta charset="utf-8">	
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>	
    <meta name="format-detection" content="telephone=no" />
    <title>window</title>	
    <link rel="stylesheet" type="text/css" href="../css/api.css" />	
    <link rel="stylesheet" type="text/css" href="../css/common.css" />	
    <style>	
     	
     .topbar {background: #ff5d5f; height:35px;position:relative}	
     	
     .whitebar {}	
     .titlebar{background-color: #ff5d5f;}
     #localrefresh {display:none;float: right; width: 40px; padding: 5px 10px;}	
     #field1::-webkit-input-placeholder { color:#fff; }	
     #field1 {height: 20px; line-height: 20px; width: 70%;}	
	
     .swipe {line-height:35px;margin-right: 10px;color: #FF8400;}	
     .back {float: left;position:absolute;left:0;top:1px;}	
     .back img {height: 14px;margin-top: 10px;margin-left: 10px;}	
     .topbar .title {line-height: 35px;text-align: center;font-size: 16px;color:#fff;}	
     #keywords{width: 70%;height: 30px;color: #fff;padding:0 10px;background: #F98687;border-radius: 5px;}
     input:-ms-input-placeholder{
		    color: #f2f2f2;
	}
	
	input::-webkit-input-placeholder{
	    color: #f2f2f2;
	}
    </style>	
  </head>	
  <body>	
    <div id="wrap">	
      <div id="thridHeader" class="titlebar">	
        <div class="topbar whitebar">	
          <div class="back" tapmode onclick="close_cur_window();"><img src="../image/back_icon_app.png" alt=""></div>	
          <div class="title" id="id_title">
          	
   				<input placeholder="请输入关键字" onclick="showSearch()" type="input" id="keywords" style="">
		

          </div>
          <span id="searchBtn" onclick="showSearch();" style="float:right;margin-right:8px;padding:5px;width:16px;display:block;font-size: 14px;position:absolute;right:0;top:4px;"><img src="../image/app_search_icon.png" style="width:100%" alt="" /></span>	
        </div>	
      </div>	
    </div>	
  </body>	
  <script type="text/javascript" src="../script/api.js"></script>	
  <script type="text/javascript" src="../script/version_update.js"></script>
  <script type="text/javascript" src="../script/qly_comm.js"></script>
  <script type="text/javascript" src="../script/loadimg.js"></script>
  <script type="text/javascript">	
    apiready = function(){	
      var thridHeader = $api.byId('thridHeader');	
      $api.fixIos7Bar(thridHeader);	
      $api.fixStatusBar( thridHeader );
      var thridHeader = $api.offset(thridHeader);	
      
      $api.val($api.byId("keywords"),api.pageParam.window_title) ; 
      var frameParams = api.pageParam.frameParams; 
      frameParams.pageParam =  api.pageParam ;
      delete frameParams.window_title ; 
     
      frameParams.rect = {
                x:0,
                y:thridHeader.h,
                w:'auto',
                h:'auto'	
            };
        api.openFrame (frameParams);
        
        
         api.addEventListener({
		    name:'viewappear'
		}, function(ret, err){        
			 if(QlyApi.getTalkingdata()){
				QlyApi.getTalkingdata().onPageStart({pageName:api.pageParam.window_title});
			}
		});
        
         api.addEventListener({
		    name:'viewdisappear'
		}, function(ret, err){        
		   if(QlyApi.getTalkingdata()){
				QlyApi.getTalkingdata().onPageEnd({pageName:api.pageParam.window_title});
			}
		});
        
        api.addEventListener({
		    name:'keyback'
		}, function(ret, err){      
		    if(QlyApi.getTalkingdata()){
				QlyApi.getTalkingdata().onPageEnd({pageName:api.pageParam.window_title});
			} 
			api.closeWin({
		        animation: {
		            type: 'push',
		            subType: 'from_left',
		            duration: 300
		        }
		    });
		});
        
        
        
        
    };	
   
    function setWinTitle(input_val){
      	$api.val($api.byId("keywords"),input_val) ;  
    }
   	function showSearch(){
   		var UISearchBar = api.require('UISearchBar');
		UISearchBar.open({
		    placeholder: '请输入搜索关键字',
		    historyCount: 10,
		    showRecordBtn: false,
		    texts: {
		        cancelText: '取消',
		        clearText: '清除搜索记录'
		    },
		    styles: {
		        navBar: {
		            bgColor: '#FFFFFF',
		            borderColor: '#ccc'
		        },
		        searchBox: {
		            bgImg: '',
		            color: '#000',
		            height: 44
		        },
		        cancel: {
		            bg: 'rgba(0,0,0,0)',
		            color: '#D2691E',
		            size: 16
		        },
		        list: {
		            color: '#696969',
		            bgColor: '#FFFFFF',
		            borderColor: '#eee',
		            size: 16
		        },
		        clear: {
		            color: '#000000',
		            borderColor: '#ccc',
		            size: 16
		        }
		    }
		},function( ret, err ){
		    if( ret ){
		        setWinTitle(ret.text);
				var jsfun = 'refreshPage(\''+ret.text+'\');';
				api.execScript({
				    frameName: 'vender_search_frame',
				    script: jsfun
				});
		    }else{
		         alert( JSON.stringify( err ) );
		    } 
		});
   	}
    
  </script>	
</html>	
